<?php
$userid = $_GET['userid'];
$newname = $_GET['newname'];
if($userid == '' || $newname == ''){
	die('参数错误');
}
require_once('../../cofd/common.php');
$sql = "select smrz from exam_user where id=?";
$stmt = $conn->prepare($sql);
$stmt->bind_param('s', $userid);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($smrz);
$stmt->fetch();
if($smrz != '' || $smrz != null){
	echo json_encode(array('status' => 401, 'msg' => '该用户已实名认证，不能修改姓名'));
}else{
	$sql = "update exam_user set name=? where id=?";
	$stmt = $conn->prepare($sql);
	$stmt->bind_param('ss', $newname, $userid);
	if($stmt->execute()){
		echo json_encode(array('status' => 200, 'msg' => '修改成功'));
	}else{
		echo json_encode(array('status' => 400, 'msg' => '修改失败'));
	}
}
$stmt->close();
$conn->close();
?>
